package com.zxl.yjb.http.manager;

import android.content.SharedPreferences;

import com.luck.picture.lib.entity.LocalMedia;
import com.zxl.yjb.app.update.CheckVersionBean;
import com.zxl.yjb.bean.AddressBookBean;
import com.zxl.yjb.bean.AddrsBean;
import com.zxl.yjb.bean.AreaBean;
import com.zxl.yjb.bean.BannerBean;
import com.zxl.yjb.bean.CanChatBean;
import com.zxl.yjb.bean.CommenBean;
import com.zxl.yjb.bean.CommentBean;
import com.zxl.yjb.bean.CouponBean;
import com.zxl.yjb.bean.DiscountAmountBean;
import com.zxl.yjb.bean.FileUploadBean;
import com.zxl.yjb.bean.ImgBean;
import com.zxl.yjb.bean.IncomeListBean;
import com.zxl.yjb.bean.LoginBean;
import com.zxl.yjb.bean.LoginSucessBean;
import com.zxl.yjb.bean.MenuClassifyBean;
import com.zxl.yjb.bean.MyWalletBean;
import com.zxl.yjb.bean.NearbyHelpBean;
import com.zxl.yjb.bean.NewsBean;
import com.zxl.yjb.bean.NewsDetailBean;
import com.zxl.yjb.bean.OrderBean;
import com.zxl.yjb.bean.OrderBindBean;
import com.zxl.yjb.bean.OrderDetailBean;
import com.zxl.yjb.bean.OrderSendBean;
import com.zxl.yjb.bean.OrderTakeBean;
import com.zxl.yjb.bean.ReadStatusBean;
import com.zxl.yjb.bean.ReasonBean;
import com.zxl.yjb.bean.SOSHaveReadBean;
import com.zxl.yjb.bean.ShareMessageDetailBean;
import com.zxl.yjb.bean.ShareMessageResponseBean;
import com.zxl.yjb.bean.ShareMsgBean;
import com.zxl.yjb.bean.ShareMsgClassifyBean;
import com.zxl.yjb.bean.SkillClassifyBean;
import com.zxl.yjb.bean.SosDetailBean;
import com.zxl.yjb.bean.UserBean;
import com.zxl.yjb.bean.VoiceUploadBean;
import com.zxl.yjb.bean.WXOrderBean;
import com.zxl.yjb.bean.ZFBOrderBean;
import com.zxl.yjb.http.api.ApiManager;
import com.zxl.yjb.http.api.RetrofitHelper;
import com.zxl.yjb.utils.Base64Object;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;


/**
 * Created by Administrator on 2017/6/17.
 */

public class DataManager {

    private ApiManager apiManager;
    private Map<String, String> params = new HashMap();
    private long timestamp;//时间戳
    private String sign;//MD5签名后的字符串
    private String token;
    private SharedPreferences sharedPreferences;
    private String type;

    public DataManager() {
        initData();
    }

    public DataManager(String type) {
        this.type = type;
        initData();
    }

    /**
     * 初始化数据
     */
    private void initData() {
        //获得ApiManager实例
        if (apiManager == null)
            apiManager = RetrofitHelper.getInstance().getApiManager();
        /*timestamp = new Date().getTime();
        params.put("timestamp", timestamp + "");
        sharedPreferences = MyApplication.getContext().getSharedPreferences("loginInfo", MODE_PRIVATE);
        token = sharedPreferences.getString("token", null);
        if (!TextUtils.isEmpty(token) && TextUtils.isEmpty(type))
            params.put("token", token);*/
    }


    /**
     * 将Observable 和 Observer进行绑定
     *
     * @param observable
     * @param observer
     * @param <T>
     */
    private <T> void toSubscribe(Observable<T> observable, Observer<T> observer) {
        observable.subscribeOn(Schedulers.io())
                .unsubscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }


    /**
     * 设置参数
     *
     * @param key
     * @param value
     */
    public void setParams(String key, String value) {
        this.params.put(key, value);
    }


    /**
     * 手机号登录
     *
     * @param observer //     * @param phone
     *                 //     * @param validateCode
     */
    public void doLogin(Observer<LoginSucessBean> observer, Map<String, String> map) {
      /*  Observable<LoginSucessBean> observable = apiManager.doLogin(timestamp + "", sign, map)
                .map(new RetrofitHelper.HttpResultFuct<LoginSucessBean>());
        toSubscribe(observable, observer);*/
    }


    /* 查看物流信息 */
    /*public void expressInfo(Observer<ExpressInfoBean> observer, Map<String, String> map) {
        Observable observable = apiManager.expressInfo(timestamp + "", sign, token, map)
                .map(new RetrofitHelper.HttpResultFuct<ExpressInfoBean>());
        toSubscribe(observable, observer);
    }*/

    /* 获取验证码 */
    public void getCode(Observer<String> observer, Map<String, String> map) {
        Observable observable = apiManager.getCode(map)
                .map(new RetrofitHelper.HttpResultFuct<String>());
        toSubscribe(observable, observer);
    }

    /* 注册登录 */
    public void isReg(Observer<LoginBean> observer, Map<String, String> map) {
        Observable observable = apiManager.isReg(map)
                .map(new RetrofitHelper.HttpResultFuct<LoginBean>());
        toSubscribe(observable, observer);
    }

    /* 融云token重新登录 */
    public void loginWithRtoken(Observer<LoginBean> observer, Map<String, String> map) {
        Observable observable = apiManager.loignWithRtoken(map)
                .map(new RetrofitHelper.HttpResultFuct<LoginBean>());
        toSubscribe(observable, observer);
    }

    /* 获取banner */
    public void getBanner(Observer<ArrayList<BannerBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.getBanner(map)
                .map(new RetrofitHelper.HttpResultFuct<ArrayList<BannerBean>>());
        toSubscribe(observable, observer);
    }

    /* 获取banner */
    public void getclassifyfist(Observer<ArrayList<MenuClassifyBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.getclassifyfist(map)
                .map(new RetrofitHelper.HttpResultFuct<ArrayList<MenuClassifyBean>>());
        toSubscribe(observable, observer);
    }

    /* 获取技能分类和菜单 */
    public void getclassify(Observer<ArrayList<SkillClassifyBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.getclassify(map)
                .map(new RetrofitHelper.HttpResultFuct<ArrayList<SkillClassifyBean>>());
        toSubscribe(observable, observer);
    }

    /* 注册技能 */
    public void regSkill(Observer<String> observer, Map<String, String> map) {
        Observable observable = apiManager.regSkill(map)
                .map(new RetrofitHelper.HttpResultFuct<String>());
        toSubscribe(observable, observer);
    }

    /* 发单列表 */
    public void yflists(Observer<ArrayList<OrderSendBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.yflists(map)
                .map(new RetrofitHelper.HttpResultFuct<ArrayList<OrderSendBean>>());
        toSubscribe(observable, observer);
    }

    /* 接单列表 */
    public void yjlists(Observer<ArrayList<OrderTakeBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.yjlists(map)
                .map(new RetrofitHelper.HttpResultFuct<ArrayList<OrderTakeBean>>());
        toSubscribe(observable, observer);
    }

    /* 接单位置 */
    public void reglocation(Observer<String> observer, Map<String, String> map) {
        Observable observable = apiManager.reglocation(map)
                .map(new RetrofitHelper.HttpResultFuct<String>());
        toSubscribe(observable, observer);
    }

    /* 本地要闻 */
    public void newsList(Observer<ArrayList<NewsBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.newsList(map)
                .map(new RetrofitHelper.HttpResultFuct<ArrayList<NewsBean>>());
        toSubscribe(observable, observer);
    }

    /* 本地要闻 */
    public void newseal(Observer<NewsDetailBean> observer, Map<String, String> map) {
        Observable observable = apiManager.newseal(map)
                .map(new RetrofitHelper.HttpResultFuct<NewsDetailBean>());
        toSubscribe(observable, observer);
    }

    /* 共享信息菜单 */
    public void shareMsgClassify(Observer<ArrayList<ShareMsgClassifyBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.shareMsgClassify(map)
                .map(new RetrofitHelper.HttpResultFuct<ArrayList<ShareMsgClassifyBean>>());
        toSubscribe(observable, observer);
    }

    /* 共享信息列表 */
    public void getClaList(Observer<ArrayList<ShareMsgBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.getClaList(map)
                .map(new RetrofitHelper.HttpResultFuct<ArrayList<ShareMsgBean>>());
        toSubscribe(observable, observer);
    }

    /* 共享信息列表 */
    public void getSharemsgList(Observer<ArrayList<ShareMsgBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.getSharemsgList(map)
                .map(new RetrofitHelper.HttpResultFuct<ArrayList<ShareMsgBean>>());
        toSubscribe(observable, observer);
    }

    /* 发单列表 */
    public void createOrder(Observer<OrderBean> observer, Map<String, String> map) {
        Observable observable = apiManager.createOrder(map)
                .map(new RetrofitHelper.HttpResultFuct<OrderBean>());
        toSubscribe(observable, observer);
    }

    /* sos求助 */
    public void sosHelp(Observer<Object> observer, Map<String, String> map) {
        Observable observable = apiManager.sosHelp(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }


    /* sos求助列表 */
    public void sosList(Observer<List<NearbyHelpBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.sosList(map)
                .map(new RetrofitHelper.HttpResultFuct<List<NearbyHelpBean>>());
        toSubscribe(observable, observer);
    }


    /* 获取用户信息 */
    public void getUserInfo(Observer<LoginSucessBean> observer,String uid) {
        Observable observable = apiManager.getUserInfo(uid)
                .map(new RetrofitHelper.HttpResultFuct<LoginSucessBean>());

        toSubscribe(observable, observer);
    }

    /* 上传图片--单张*/

    public void uploadPicture(Observer<ImgBean> observer, String picPath) {
        String suffixame = picPath.substring(picPath.lastIndexOf(".") + 1);//获取文件后缀名
        String base64Img = "data:image/" + suffixame + ";base64," + Base64Object.fileToString(picPath);
        Observable observable = apiManager.uploadPictures(base64Img)
                .map(new RetrofitHelper.HttpResultFuct<ImgBean>());
        toSubscribe(observable, observer);
    }

    //修改昵称
    public void upDateUserInfo(Observer<Object> observer, LoginSucessBean userBean) {

        /*Observable observable1 = apiManager.xgFaceimg(userBean.getFace_img())
                .map(new RetrofitHelper.HttpResultFuct<Object>());*/

        Observable observable2 = apiManager.xgNickName(userBean.getNickname())
                .map(new RetrofitHelper.HttpResultFuct<Object>());

        Observable observable3 = apiManager.xgGender(userBean.getSex()+"")
                .map(new RetrofitHelper.HttpResultFuct<Object>());

        Observable observable4 = apiManager.xgBirthday(userBean.getBirthday())
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        Observable.merge( observable2,observable3,observable4)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);
    }

    //修改昵称
    public void xgNickName(Observer<Object> observer, String nickName) {
        Observable observable = apiManager.xgNickName(nickName)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }
    //修改生日
    public void xgBirthday(Observer<Object> observer, String birthday) {
        Observable observable = apiManager.xgBirthday(birthday)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }
    //修改头像
    public void xgFaceimg(Observer<Object> observer, String faceImg) {
        Observable observable = apiManager.xgFaceimg(faceImg)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }
    //修改性别
    public void xgGender(Observer<Object> observer, String gender) {
        Observable observable = apiManager.xgGender(gender)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }

    /* 好友黑名单 */
    public void friendsList(Observer<List<UserBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.friendsList(map)
                .map(new RetrofitHelper.HttpResultFuct<List<UserBean>>());
        toSubscribe(observable, observer);
    }
    /* 好友黑名单 */
    public void friendsSkillList(Observer<List<UserBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.friendsSkillList(map)
                .map(new RetrofitHelper.HttpResultFuct<List<UserBean>>());
        toSubscribe(observable, observer);
    }

    /* 我的优惠券 */
    public void voucherList(Observer<CouponBean> observer) {
        Observable observable = apiManager.voucherList("")
                .map(new RetrofitHelper.HttpResultFuct<CouponBean>());
        toSubscribe(observable, observer);
    }

    /* 移除黑名单 */
    public void deletefriend(Observer<Object> observer, String id) {
        Observable observable = apiManager.deletefriend(id)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }

    /* 添加黑名单 */
    public void addFriend(Observer<Object> observer,  Map<String, String> map) {
        Observable observable = apiManager.addFriend(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }

    /*  获取别人对我的评论*/
    public void getCommenList(Observer<List<CommenBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.getCommenList(map)
                .map(new RetrofitHelper.HttpResultFuct<List<CommenBean>>());
        toSubscribe(observable, observer);
    }

    /*  获取评论*/
    public void evaluate_other2uid_list(Observer<CommentBean> observer, Map<String, String> map) {
        Observable observable = apiManager.evaluate_other2uid_list(map)
                .map(new RetrofitHelper.HttpResultFuct<CommentBean>());
        toSubscribe(observable, observer);
    }

    /*  我的收入明细*/
    public void incomeDetails(Observer<List<MyWalletBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.incomeDetails(map)
                .map(new RetrofitHelper.HttpResultFuct<List<MyWalletBean>>());
        toSubscribe(observable, observer);
    }

    /*  发布评论*/
    public void evaluate(Observer<Object> observer, Map<String, String> map) {
        Observable observable = apiManager.evaluate(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }



    /*  我的提现列表*/
    public void withdrawList(Observer<List<MyWalletBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.withdrawList(map)
                .map(new RetrofitHelper.HttpResultFuct<List<MyWalletBean>>());
        toSubscribe(observable, observer);
    }



    /*  提现*/
    public void withdrawals(Observer<Object> observer, Map<String, String> map) {
        Observable observable = apiManager.withdrawals(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }

    /*  订单详情*/
    public void orderDetail(Observer<OrderDetailBean> observer, Map<String, String> map) {
        Observable observable = apiManager.orderDetail(map)
                .map(new RetrofitHelper.HttpResultFuct<OrderDetailBean>());
        toSubscribe(observable, observer);
    }

    public void sosDetail(Observer<SosDetailBean> observer, Map<String, String> map) {
        Observable observable = apiManager.sosDetail(map)
                .map(new RetrofitHelper.HttpResultFuct<SosDetailBean>());
        toSubscribe(observable, observer);
    }

    /*  语音文件上传*/
    public void uploadVoice(Observer<VoiceUploadBean> observer, String path) {

        File file = new File(path);
        RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file);
        Observable observable = apiManager.uploadVoice(MultipartBody.Part.createFormData("yypath", file.getName(), requestFile))
                .map(new RetrofitHelper.HttpResultFuct<VoiceUploadBean>());
        toSubscribe(observable, observer);
    }

    /*  多张图片上传 */
    public void uploadMultiPicture(Observer<FileUploadBean> observer, List<LocalMedia> picList) {

        MultipartBody.Part[] parts = new MultipartBody.Part[picList.size()];
        for (int i = 0; i < picList.size(); i++) {
            parts[i] = getMuiltpartBody(picList.get(i).getPath(),i);
        }
        Observable observable = apiManager.uploadMultiPicture(parts)
                .map(new RetrofitHelper.HttpResultFuct<FileUploadBean>());
        toSubscribe(observable, observer);
    }

    /**
     * 获取MultipartBody对象
     *
     * @param picPath
     */
    private MultipartBody.Part getMuiltpartBody(String picPath,int i) {
        File file = new File(picPath);
        RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/related"), file);
        return MultipartBody.Part.createFormData("file[]", file.getName(), requestFile);
    }


    /*  发布天数、折扣、对应价格*/
    public void getFeeDiscountAmount(Observer<ArrayList<DiscountAmountBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.getFeeDiscountAmount(map)
                .map(new RetrofitHelper.HttpResultFuct<ArrayList<DiscountAmountBean>>());
        toSubscribe(observable, observer);
    }


    /*  支付宝支付*/
    public void payZFB(Observer<ZFBOrderBean> observer, Map<String, String> map) {
        Observable observable = apiManager.payZFB(map)
                .map(new RetrofitHelper.HttpResultFuct<ZFBOrderBean>());
        toSubscribe(observable, observer);
    }

    /*  微信支付*/
    public void payWX(Observer<WXOrderBean> observer, Map<String, String> map) {
        Observable observable = apiManager.payWX(map)
                .map(new RetrofitHelper.HttpResultFuct<WXOrderBean>());
        toSubscribe(observable, observer);
    }

    //绑定订单到好友
    public void bindOrderToUser(Observer<Object> observer,  Map<String, String> map) {
        Observable observable = apiManager.bindOrderToUser(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }


    //订单完成
    public void orderConfirm(Observer<Object> observer,  Map<String, String> map) {
        Observable observable = apiManager.orderConfirm(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }

    //撤单
    public void cancelororder(Observer<Object> observer,  Map<String, String> map) {
        Observable observable = apiManager.cancelororder(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }

    //获取撤单原因
    public void getreason(Observer<List<ReasonBean>> observer) {
        Observable observable = apiManager.getreason()
                .map(new RetrofitHelper.HttpResultFuct<List<ReasonBean>>());
        toSubscribe(observable, observer);
    }



    //查询与某人所有订单
    public void getOrderListForUser(Observer<List<OrderBindBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.getOrderListForUser(map)
                .map(new RetrofitHelper.HttpResultFuct<List<OrderBindBean>>());
        toSubscribe(observable, observer);
    }

    /* 接单*/
    public void accept(Observer<Object> observer, Map<String, String> map) {
        Observable observable = apiManager.accept(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }

    /* 发布共享信息*/
    public void publishShareMessage(Observer<ShareMessageResponseBean> observer, Map<String, String> map) {
        Observable observable = apiManager.publishShareMessage(map)
                .map(new RetrofitHelper.HttpResultFuct<ShareMessageResponseBean>());
        toSubscribe(observable, observer);
    }

    /* 共享信息详情 */
    public void getMessageDetail(Observer<ShareMessageDetailBean> observer, Map<String, String> map) {
        Observable observable = apiManager.getMessageDetail(map)
                .map(new RetrofitHelper.HttpResultFuct<ShareMessageDetailBean>());
        toSubscribe(observable, observer);
    }

    /* 添加收藏 */
    public void setCollection(Observer<Object> observer, Map<String, String> map) {
        Observable observable = apiManager.setCollection(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }

    /* 删除收藏信息 */
    public void delCollection(Observer<Object> observer, Map<String, String> map) {
        Observable observable = apiManager.delCollection(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }
    /* 收藏列表 */
    public void getCollection(Observer<ArrayList<ShareMsgBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.getCollection(map)
                .map(new RetrofitHelper.HttpResultFuct<ArrayList<ShareMsgBean>>());
        toSubscribe(observable, observer);
    }

    /* 历史提问列表 */
    public void getHistory(Observer<ArrayList<ShareMsgBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.getHistory(map)
                .map(new RetrofitHelper.HttpResultFuct<ArrayList<ShareMsgBean>>());
        toSubscribe(observable, observer);
    }

    /* 历史提问列表 */
    public void getAround4skill(Observer<List<UserBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.getAround4skill(map)
                .map(new RetrofitHelper.HttpResultFuct<List<UserBean>>());
        toSubscribe(observable, observer);
    }

    /* 订单列表已读未读状态 */
    public void orderlist_read_get_status(Observer<ReadStatusBean> observer, Map<String, String> map) {
        Observable observable = apiManager.orderlist_read_get_status(map)
                .map(new RetrofitHelper.HttpResultFuct<ReadStatusBean>());
        toSubscribe(observable, observer);
    }

    /* 发单列表已读未读状态 */
    public void orderlist_request_read_get_status(Observer<ReadStatusBean> observer, Map<String, String> map) {
        Observable observable = apiManager.orderlist_request_read_get_status(map)
                .map(new RetrofitHelper.HttpResultFuct<ReadStatusBean>());
        toSubscribe(observable, observer);
    }
    /* 首页发单接单已读未读状态 */
    public void orderlist_mainpage_read_status(Observer<ReadStatusBean> observer, Map<String, String> map) {
        Observable observable = apiManager.orderlist_mainpage_read_status(map)
                .map(new RetrofitHelper.HttpResultFuct<ReadStatusBean>());
        toSubscribe(observable, observer);
    }

    /* 订单列表已读未读状态 */
    public void order_accept1refuse2_page_state(Observer<ArrayList<OrderTakeBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.order_accept1refuse2_page_state(map)
                .map(new RetrofitHelper.HttpResultFuct<ArrayList<OrderTakeBean>>());
        toSubscribe(observable, observer);
    }

    /* 消息免打扰 */
    public void set_no_receive_order_jpush(Observer<Object> observer, Map<String, String> map) {
        Observable observable = apiManager.set_no_receive_order_jpush(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }

    /* 上传更新照片墙 */
    public void photowall_add_update(Observer<Object> observer, Map<String, String> map) {
        Observable observable = apiManager.photowall_add_update(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }
    /* 请求照片墙 */
    public void photowall_list(Observer<ArrayList<String>> observer, Map<String, String> map) {
        Observable observable = apiManager.photowall_list(map)
                .map(new RetrofitHelper.HttpResultFuct<ArrayList<String>>());
        toSubscribe(observable, observer);
    }

    /* 查询是否可以聊天 */
    public void canRYChat(Observer<CanChatBean> observer, Map<String, String> map) {
        Observable observable = apiManager.canRYChat(map)
                .map(new RetrofitHelper.HttpResultFuct<CanChatBean>());
        toSubscribe(observable, observer);
    }
    /* 查询可提现金额 */
    public void incomeList(Observer<IncomeListBean> observer, Map<String, String> map) {
        Observable observable = apiManager.incomeList(map)
                .map(new RetrofitHelper.HttpResultFuct<IncomeListBean>());
        toSubscribe(observable, observer);
    }

    /* 查询可提现金额 */
    public void getNewVersion(Observer<CheckVersionBean> observer, Map<String, String> map) {
        Observable observable = apiManager.getNewVersion(map)
                .map(new RetrofitHelper.HttpResultFuct<CheckVersionBean>());
        toSubscribe(observable, observer);
    }

    /* 删除历史共享信息 */
    public void delHistory(Observer<Object> observer, Map<String, String> map) {
        Observable observable = apiManager.delHistory(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }

    /* 删除失效单 */
    public void del_invalidOrder(Observer<Object> observer, Map<String, String> map) {
        Observable observable = apiManager.del_invalidOrder(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }

    /* sos是否未读 */
    public void sosHaveNoRead(Observer<SOSHaveReadBean> observer, Map<String, String> map) {
        Observable observable = apiManager.sosHaveNoRead(map)
                .map(new RetrofitHelper.HttpResultFuct<SOSHaveReadBean>());
        toSubscribe(observable, observer);
    }

    /* 获取省份列表 */
    public void getAreaAllProvince(Observer<List<AreaBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.getAreaAllProvince(map)
                .map(new RetrofitHelper.HttpResultFuct<List<AreaBean>>());
        toSubscribe(observable, observer);
    }

    /* 子级联列表 */
    public void selectNationalByPid(Observer<List<AreaBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.selectNationalByPid(map)
                .map(new RetrofitHelper.HttpResultFuct<List<AreaBean>>());
        toSubscribe(observable, observer);
    }

    /* 免费发布接口 */
    public void freeTopicAction(Observer<Object> observer, Map<String, String> map) {
        Observable observable = apiManager.freeTopicAction(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }

    /* 免费发布接口 */
    public void sosdel(Observer<Object> observer, Map<String, String> map) {
        Observable observable = apiManager.sosdel(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }

    /* 免费发布接口 */
    public void addressBook_list(Observer<AddressBookBean> observer, Map<String, String> map) {
        Observable observable = apiManager.addressBook_list(map)
                .map(new RetrofitHelper.HttpResultFuct<AddressBookBean>());
        toSubscribe(observable, observer);
    }

    /* 免费发布接口 */
    public void addressBook_add(Observer<Object> observer, Map<String, String> map) {
        Observable observable = apiManager.addressBook_add(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }

    /* 免费发布接口 */
    public void addressBook_update(Observer<Object> observer, Map<String, String> map) {
        Observable observable = apiManager.addressBook_update(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }

    /* 免费发布接口 */
    public void addressBook_del(Observer<Object> observer, Map<String, String> map) {
        Observable observable = apiManager.addressBook_del(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }

    /* 免费发布接口 */
    public void suggest_send(Observer<Object> observer, Map<String, String> map) {
        Observable observable = apiManager.suggest_send(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }
    /* 免费发布接口 */
    public void soslist_my(Observer<List<NearbyHelpBean>> observer, Map<String, String> map) {
        Observable observable = apiManager.soslist_my(map)
                .map(new RetrofitHelper.HttpResultFuct<List<NearbyHelpBean>>());
        toSubscribe(observable, observer);
    }

    /* 免费发布接口 */
    public void addIdCard(Observer<Object> observer, Map<String, String> map) {
        Observable observable = apiManager.addIdCard(map)
                .map(new RetrofitHelper.HttpResultFuct<Object>());
        toSubscribe(observable, observer);
    }

    /* 免费发布接口 */
    public void getAllProvince(Observer<AddrsBean> observer, String url) {
        Observable observable = apiManager.getAllProvince(url);
        toSubscribe(observable, observer);
    }


}
